package Homework4;

import org.openqa.selenium.By;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;

/**
 * Created by Виталий on 25.03.14.
 */
public class NegativeRegistrarionRozetka extends BaseClass {
    @DataProvider(name = "test1")
    public Object[][] createData1() {
        return new Object[][] {
                { "Vit", "vitaliiasxsdasd112@gmail.com", "12345adssa" },
                { "Vitaliiaas1234", "vitaliiasxsdasd112zxczxc@gmail.com", "12345adsa" },
                { "Vitaliiaas1234", "vitaliiasxsdasd112@gmail.com", "12345adsa" },
        };
    }
    @Test(dataProvider = "test1")
    public void test(String Name, String Email, String Password) throws Exception {
        driver.get(baseUrl);
        System.out.println("Begin Test - NegativeRegistration");
        System.out.println("HomePage");

        driver.manage().window().maximize();

        driver.findElement(By.xpath("//*[@id='user_menu']/div/a")).click();

        driver.findElement(By.xpath("/html/body/header/div/div/div/div[3]/div[3]/div/div/div/form/div[5]/a")).click();

        driver.findElement(By.name("title")).sendKeys(Name);

        driver.findElement(By.name("email")).sendKeys(Email);

        driver.findElement(By.name("password")).sendKeys(Password);

        driver.findElement(By.className("button-css-green")).click();

        Assert.assertTrue(driver.findElement(By.name("app-message")).isEnabled(), "No Error Message");
    }
}
